commodity_cart = []
shopping_if_have_commodity = {"honey":50,
                              "meat":20,
                              "beef":30,
                              "clothes":200,
                              "Laundry detergent":30,
                              "book":30,
                              "coffee":20,
                              "pen":8,
                              "pencil":2,
                              "milk":20
                              }
# 自己带了多少钱
money = int(input("想一想，自己带了多少钱\n"))
# 作最后退出的选择按钮
chance = True
while chance:
    get_item = input("想购买什么\n")
    if get_item in shopping_if_have_commodity.keys():
        if shopping_if_have_commodity["{}".format(get_item)] < money:
            commodity_cart.append(get_item)
            money -= shopping_if_have_commodity[get_item]
            print("恭喜，购买成功！您的卡余额还剩{}".format(money))
        else:
            print("穷鬼，钱不够！请到其他超市购买！")

    else:
        print("没有这个商品，别瞎弄！")
    chance = input("是否还想继续购买yes/no\n")
    if chance == "yes":
        chance = True
    else:
        chance = False
print("您购买了以下几项物品:{}".format(commodity_cart))


